package com.example.casper.Experiment2024.items;

import android.net.Uri;
import java.io.Serializable;
import java.net.URL;
import java.util.Objects;

public class Location implements Serializable {
    private String pic; // 存储图片URI
    private String locationName;
    private double latitude;
    private double longitude;
    private String feeling;
    private String province;
    private static final long serialVersionUID = 1L;
    public Location() {
    }
    public Location(Uri imag, String locationName, double latitude, double longitude, String feeling) {
        this.pic=imag.toString();
        this.locationName = locationName;
        this.latitude = latitude;
        this.longitude = longitude;
        this.feeling = feeling;
    }
    public String getProvince() {
        return province;
    }
    public Uri getPicPath() {
        return Uri.parse(pic);
    }

    public String getLocationName() {
        return locationName;
    }

    public double getLatitude() {
        return latitude;
    }

    public double getLongitude() {
        return longitude;
    }

    public String getFeeling() {
        return feeling;
    }
    public void setProvince(String province) {
        this.province = province;
    }
    public void setPicPath(Uri picPath) {
        this.pic = picPath.toString();
    }

    public void setLocationName(String locationName) {
        this.locationName = locationName;
    }

    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }

    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    public void setFeeling(String feeling) {
        this.feeling = feeling;
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null || getClass() != obj.getClass()) return false;
        Location location = (Location) obj;
        return Double.compare(location.latitude, latitude) == 0 &&
                Double.compare(location.longitude, longitude) == 0 &&
                locationName.equals(location.locationName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(locationName, latitude, longitude);
    }

}